package utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTimeUtil {

    public static void main(String[] args) {

        System.out.println(new Date());

        System.out.println(getDateTime());

        System.out.println(getDate());

        System.out.println(getTime());

    }


    public static String getDateTime() {

        SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
        String date = format.format(new Date());

        return date;
    }



    public static String getDate() {
        SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd");
        String date = format.format(new Date());

        return date;
    }


    public static String getTime() {

        SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
        String time = format.format(new Date());

        return time;
    }
}
